package com.cqw.service;

import com.alibaba.fastjson.JSON;
import com.cqw.vo.HttpResponse;
import com.cqw.vo.ParamVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @Author: caoqingwen
 * @CreateTime: 2021-04-27 11:56
 * @Description:
 */
@Service
@Slf4j
public class HttpService {

    @Autowired
    private RestTemplate restTemplate;

    public void doPost() {
        String url = "https://tptbrtctest.life.cntaiping.com/tptb-info/admin/activity/create";
        ParamVO paramVO = new ParamVO();
        paramVO.setTitle("2323");
        paramVO.setActivityTemplateId(11);
        paramVO.setActivityThumbUrl("");
        paramVO.setCategoryId(41);
        paramVO.setCategoryName("太平要闻");


        HttpResponse baseResponse = restTemplate.postForObject(url, paramVO, HttpResponse.class);
        System.out.println(JSON.toJSONString(baseResponse));


    }

}
